#region File Description
//-----------------------------------------------------------------------------
// LineSettingsReader.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace XDL.Framework.Particles
{
    /// <summary>
    /// Content Pipeline class for loading Line Settings data from XNB format.
    /// </summary>
    class LineSettingsReader : ContentTypeReader<LineSettings>
    {
        protected override LineSettings Read(ContentReader input,
                                                 LineSettings existingInstance)
        {
            LineSettings settings = new LineSettings();

            settings.LineEffect = input.ReadObject<Effect>();
            settings.TechniqueName = input.ReadString();
            settings.MaxLines = input.ReadInt32();
            settings.Duration = input.ReadObject<TimeSpan>();
            settings.EmitterVelocitySensitivity = input.ReadSingle();
            settings.Gravity = input.ReadVector3();
            settings.EndVelocity = input.ReadSingle();
            settings.BlendState = input.ReadObject<BlendState>();
            if (input.ReadBoolean() == true)
                settings.GroundLevel = (float)input.ReadDouble();

            return settings;
        }
    }
}
